<template>
  <div class="content">
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{path:'/'}">首页</el-breadcrumb-item>
      <el-breadcrumb-item >政策法规列表页</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="main">
      <el-table v-loading="loading" :data="dataList" :header-cell-style="{background:'#f6fdfd',color:'#000'}"
        @row-click="goDetail"
      >
        <el-table-column label="序号" type="index" width="233"></el-table-column>
        <el-table-column label="政策法规标题" width="530" prop="title"></el-table-column>
        <el-table-column label="发布时间" prop="publishDatetime">
          <slot slot-scope="scope">
            {{ parseTime(scope.row.publishDatetime,'{y}-{m}-{d}') }}
          </slot>
        </el-table-column>
      </el-table>
      <Pagination
        v-show="total > 0 "
        :page.sync="queryParams.pageNum"
        :limit.sync = "queryParams.pageSize"
        :total="total" 
        @Pagination="getList"
      ></Pagination>
    </div>
  </div>
</template>

<script>
import {listPolicylaw} from '@/api/bid/policylaw'
export default {
  name: "list",
  data() {
    return {
      loading:true,
      dataList:[],
      queryParams:{
        pageSize:10,
        pageNum:1,
      },
      total:0,
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    getList(){
      listPolicylaw(this.queryParams).then(res=>{
        console.log(res);
        this.total = res.total
        this.dataList = res.rows
        this.loading=false
      })
    },
    goDetail(row){
      this.$router.push('/policylaw/detail?id='+row.id)
    }
  }
}
</script>

<style lang="scss" scoped>
.content{
  width: 90%;
  .main{
    margin: 30px;
  }
}
::v-deep .el-pagination{
  display: flex;
  position: relative;
  justify-content: center;
}

::v-deep .el-pager .active{
  color: #1dd0b7;
}
</style>
